﻿using System.Workflow.ComponentModel;
using System.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.ComponentModel.Design;
using System;
using System.Collections.Generic;
using System.Workflow.ComponentModel.Compiler;

using BPM.Base.WFLib;

namespace BPM.Base.WFLib.CustomerAttribute
{
	

    public class TemplateValidator : System.Workflow.ComponentModel.Compiler.ActivityValidator
    {
        public override ValidationErrorCollection ValidateProperties(ValidationManager manager, object obj)
        {
            ValidationErrorCollection Errors = base.ValidateProperties(manager, obj);

            CompositeActivity t = obj as CompositeActivity;
         
            if (t!= null)
            {
                if (t.Activities.Count!=0 )
                {
                    this.wxdValueValidator(Errors,t);
                }
            }
            return Errors;
        }

        private void wxdValueValidator(ValidationErrorCollection Errors, object obj)
        {
            if (obj is 状态机模板)
            {
                状态机模板 activity = obj as 状态机模板;


                if (string.IsNullOrEmpty(activity.模板名称))
                {
                    Errors.Add(ValidationError.GetNotSetValidationError(状态机模板.模板名称Property.Name));
                }
            }
          
        }

    }

}
